package com.jingtai.platform.controller.merchants;

import com.jingtai.core.entity.member.MemberAddress;
import com.jingtai.platform.service.merchants.MemberAddressService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 用户收货地址表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:33
 */
@Validated
@RestController
@RequestMapping("/platform/memberaddress")
@Api(tags = "用户收货地址表")
public class MemberAddressController{

    @Autowired
    private MemberAddressService memberAddressService;


    @ApiOperation("用户收货地址表列表查询")
    @GetMapping("/list")
    public ResultUtil aopMemberAddressList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return memberAddressService.MemberAddresslist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询memberAddress实体")
    @GetMapping("/getMemberAddressById")
    public ResultUtil GetMemberAddressById(@CApiParam(name = "id",value = "memberAddress实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return memberAddressService.getMemberAddressById(id);
    }


    @ApiOperation("新增memberAddress实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"memberAddress.id","memberAddress.createTime","memberAddress.updateTime","memberAddress.deleteFlag"})
    public ResultUtil aopAddMemberAddress(@RequestBody @Validated MemberAddress memberAddress){
        return memberAddressService.addMemberAddress(memberAddress);
    }

    @ApiOperation("编辑memberAddress实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"memberAddress.createTime","memberAddress.updateTime","memberAddress.deleteFlag"})
    public ResultUtil aopEditMemberAddress(@RequestBody @Validated MemberAddress memberAddress){
        return memberAddressService.editMemberAddress(memberAddress);
    }

    @ApiOperation("根据ID删除memberAddress实体")
    @GetMapping("/delMemberAddressById")
    public ResultUtil aopDelMemberAddressById(@CApiParam(name = "id",value = "memberAddress实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return memberAddressService.delMemberAddressById(id);
    }

}






